package com.sky.mapper;

import com.sky.dto.GoodsSalesDTO;
import com.sky.entity.OrderDetail;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Mapper
public interface OrderDetailMapper {


    void insert(List<OrderDetail> orderDetailList);

    @Select("select * from order_detail where order_id=#{OrderId}")
    List<OrderDetail> getByOrderId(Long OrderId);

    @Select("select name from order_detail")
    List<String> getAllDishName();

//    @Select("select od.name,sum(od.number) number from order_detail od,orders o where od.order_id = o.id and o.status = 5 and o.order_time > '2022-01-01'\n" +
//            "group by od.name order by number desc")
//    Integer getSalesCount(String dishName,Integer status);


    List<GoodsSalesDTO> getSalesCount(LocalDateTime begin, LocalDateTime end, Integer status);
}
